package freemarker;
/*
 * 此类作废，经学习讨论后freemarker引擎的方法写在demo2中的TestListenerDemo1中
 * 使用JavaMail发送测试报告写在src/com.wbtest.core/WebTestListener1 中
 */
import java.io.File;
import java.io.FileWriter;
import java.io.Writer;
import java.util.HashMap;
import java.util.Map;

import org.apache.poi.hpsf.Date;

import demo2.Demo1;
import freemarker.template.Configuration;
import freemarker.template.Template;

public class freemarkerDemo1 extends Demo1 {

	public static void main(String[] args) throws Exception {
		Configuration conf = new Configuration(Configuration.getVersion());
		conf.setDirectoryForTemplateLoading(new File("./template"));
		conf.setDefaultEncoding("utf-8");

		Template template = conf.getTemplate("freemarkerDemo.flt");

		Map root = new HashMap();
		root.put("msg", "第一个测试");
		root.put("cur_time", new Date());
		root.put("hello", "执行了2个成功的");

		Writer out = new FileWriter(new File("./template/freemarkerDemo.html"));
		template.process(root, out);
		System.out.println("success");
		out.flush();
		out.close();
	}

}
